/*
** my_printf_funct_02.c for  in /home/gueux_g/projet/my_printf/bin
**
** Made by gueux-g
** Login   <gueux_g@epitech.net>
**
** Started on  Sun Nov 18 09:45:01 2012 gueux-g
** Last update Sun Nov 18 16:45:17 2012 gueux-g
*/

#include	<stdio.h>
#include	<stdarg.h>

void		my_maxi_hexa(va_list ap)
{
  my_putnbr_base(va_arg(ap, unsigned int), "0123456789ABCDEF");
}

void		my_char(va_list ap)
{
  my_putchar((char) va_arg(ap, int));
}

void		my_str(va_list ap)
{
  my_putstr(va_arg(ap, char *));
}

void		my_sp_str(va_list ap)
{
  char		*str;
  int		i;

  i = 0;
  str = va_arg(ap, char *);
  while (str[i] != 0)
    {
      if (str[i] < 32 || str[i] >= 127)
	{
	  my_putchar('\\');
	  if (str[i] < 10)
	    my_putstr("00");
	  if (str[i] >= 10 && str[i] < 32)
	    my_putstr("0");
	  my_putnbr_base(str[i], "01234567");
	}
      else
	my_putchar(str[i]);
      i++;
    }
}

void		my_percent(va_list ap)
{
  my_putchar('%');
}
